package com.example.common.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * --- 天道酬勤 ---
 *
 * @author Xiaoze
 * @date 2024/8/12
 * @desc
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class R<T> {
    private int code;
    private String msg;
    private T data;

    /**
     * 成功
     */
    public static <T> R<T> ok(T data) {
        return new R<>(20000, "成功", data);
    }


    /**
     * 失败
     */
    public static <T> R<T> fail(T data) {
        return new R<>(400, "操作失败", data);
    }

}
